package org.jeecg.modules.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.nikeProject.entity.AreaCity;
import org.jeecg.modules.nikeProject.entity.AreaProvince;
import org.jeecg.modules.nikeProject.mapper.AreaCityMapper;
import org.jeecg.modules.nikeProject.mapper.AreaProvinceMapper;
import org.jeecg.modules.system.service.IAreaProvinceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

@Service
public class AreaServiceImpl  extends ServiceImpl<AreaProvinceMapper, AreaProvince> implements IAreaProvinceService {

    @Autowired
    private AreaProvinceMapper areaProvinceMapper;
    @Autowired
    private AreaCityMapper areaCityMapper;

    @Override
    public List<AreaProvince> getAreaProvinces() {
        LambdaQueryWrapper<AreaProvince> queryWrapper = new LambdaQueryWrapper<>();
        return areaProvinceMapper.selectList(queryWrapper);
    }

    @Override
    public List<AreaCity> getCityListByProvinceCode(String provinceCode) {
        LambdaQueryWrapper<AreaCity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(AreaCity::getProvinceCode, provinceCode);
        return areaCityMapper.selectList(lambdaQueryWrapper);
    }


}
